const state = {
  admin: 'user'
}

const mutations = {
  adduser(state, data) {
    state.admin = data
  }
}

const actions = {
  // 管理员登录
  login({ state, commit }, params) {
    return admin.login(params)
  },

  // 获取当前管理员信息
  async auth({ state, commit }, params) {
    const res = await admin.auth(params)
    commit('SET_USER_INFO', res.data.data)
    return res
  }
}

export default {
  namespaced: true,
  state,
  actions,
  mutations
}
